import java.util.Timer;
import java.util.TimerTask;

/**
 * Created with IntelliJ IDEA.
 * Description:定时器的使用
 * User: 邓大帅
 * Date: 2024-01-25
 * Time: 17:08
 */
public class ThreadDemo5 {
    public static void main(String[] args) {
//        Timer内置了线程
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello");
            }
        }, 2000);
        System.out.println("hello main");
    }
}
